﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfStudy.MyControls
{
    /// <summary>
    /// ElectronicsListItemView.xaml 的交互逻辑
    /// </summary>
    public partial class ElectronicsListItemView : UserControl
    {
        private Electronics electronics;
        public ElectronicsListItemView()
        {
            InitializeComponent();
        }
        public Electronics Electronics
        {
            get { return electronics; }
            set {
                electronics = value;
                textBlockName.Text = electronics.Name;
                textBlockPrice.Text = electronics.Price;
                string uriStr = $@"../Resource/image/icon/{electronics.Type}Icon.png";
                imageIcon.Source = new BitmapImage(new Uri(uriStr, UriKind.Relative));
            }
        }
    }
}
